<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/18 0018
  Time: 20:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>搜索条件</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">客户名称：</label>
        <div class="layui-input-inline">
            <input type="text" name="name" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">模糊查询</div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户状态：</label>
            <div class="layui-input-inline">
                <select name="status">
                    <option value="">请选择</option>
                    <option value="0">成交客户</option>
                    <option value="1">潜在客户</option>
                    <option value="2">意向客户</option>
                    <option value="3">失败客户</option>
                    <option value="4">已流失客户</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户类别：</label>
            <div class="layui-input-inline">
                <select name="type">
                    <option value="">请选择</option>
                    <option value="1">普通客户</option>
                    <option value="2">VIP客户</option>
                    <option value="3">老客户</option>
                    <option value="4">代理商</option>
                    <option value="5">供应商</option>
                    <option value="6">合作伙伴</option>
                    <option value="7">其他</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户来源：</label>
            <div class="layui-input-inline">
                <select name="source">
                    <option value="">请选择</option>
                    <option value="1">注册会员</option>
                    <option value="2">朋友介绍</option>
                    <option value="3">手动录入</option>
                    <option value="4">客户介绍</option>
                    <option value="5">电子商务</option>
                    <option value="6">合作伙伴</option>
                    <option value="7">广告</option>
                    <option value="8">职员引介</option>
                    <option value="9">市场活动</option>
                    <option value="10">口头传达</option>
                    <option value="11">其他</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户等级：</label>
            <div class="layui-input-inline">
                <select name="level">
                    <option value="">请选择</option>
                    <option value="1">☆</option>
                    <option value="2">☆☆</option>
                    <option value="3">☆☆☆</option>
                    <option value="4">☆☆☆☆</option>
                    <option value="5">☆☆☆☆☆</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户信用度：</label>
            <div class="layui-input-inline">
                <select name="credit">
                    <option value="">请选择</option>
                    <option value="1">☆</option>
                    <option value="2">☆☆</option>
                    <option value="3">☆☆☆</option>
                    <option value="4">☆☆☆☆</option>
                    <option value="5">☆☆☆☆☆</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户成熟度：</label>
            <div class="layui-input-inline">
                <select name="maturity">
                    <option value="">请选择</option>
                    <option value="1">A+：明确成交意向</option>
                    <option value="2">A-：有初步成交意向</option>
                    <option value="3">B+：关键人有成交意向</option>
                    <option value="4">B-：关键人成交意向不确定</option>
                    <option value="5">C+：初步联系，有意向</option>
                    <option value="6">C-：初步联系，意向不确定</option>
                    <option value="7">D：新建客户</option>
                    <option value="8">E：明显拒绝</option>
                    <option value="9">F：无效客户</option>
                </select>
            </div>
        </div>
    </div>
    <%--    lay-submit:标识该按钮可以提交表单--%>
    <div class="layui-form-item" style="width: 450px;margin-top: 40px;">
        <div class="layui-input-block">
            <button lay-submit lay-filter="reset" class="layui-btn" style="margin-left: 135px;">重置</button>
            <button lay-submit lay-filter="query" class="layui-btn">查询</button>
        </div>
    </div>
</form>

<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form','jquery'], function(){
        var layer = layui.layer
            ,form = layui.form;
        var $=layui.$;
        //异步提交表单
        form.on("submit(query)",function (data) {
            $.post("${pageContext.request.contextPath}/customer/search",data.field,function (result) {
                if (result.code==0){
                    layer.msg("查询成功！");
                    //刷新父窗口内容
                    parent.layui.table.reload("customerTable",{
                        where:{
                            params:data.field
                        },//查询条件
                        page:{
                            curr:1
                        }
                    })
                    //关闭弹出
                    var index=parent.layer.getFrameIndex(window.name);//先得到当前frame层的索引
                    parent.layer.close(index);//再执行关闭
                }
            },"json")
            return false;//阻止表单提交
        })
    });
</script>

</body>
</html>
